翻訳と辞書
Words near each other
・ Automatic painting
・ Automatic parallelization
・ Automatic parallelization tool
・ Automatic parking
・ Automatic Performance Control
・ Automatic Picture Transmission
・ Automatic Pilot
・ Automatic pistol
・ Automatic platform gate
・ Automatic Press / VIP
・ Automatic Pressure Tracking Adiabatic Calorimeter
・ Automatic programming
・ Automatic quartz
・ Automatic radar plotting aid
・ Automatic redial
Automatic Reference Counting
・ Automatic repeat request
・ Automatic revolver
・ Automatic rifle
・ Automatic ring back
・ Automatic route selection
・ Automatic scorer
・ Automatic Secure Voice Communications Network
・ Automatic Self-Cleansing Filter Syndicate Co Ltd v Cuninghame
・ Automatic semigroup
・ Automatic sequence
・ Automatic server discovery
・ Automatic shotgun
・ Automatic soap dispenser
・ Automatic sounding


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Automatic Reference Counting : ウィキペディア英語版
Automatic Reference Counting
In Objective-C and Swift programming, Automatic Reference Counting (ARC) is a memory management enhancement where the burden of keeping track of an object's reference count is lifted from the programmer to the compiler. In traditional Objective-C, the programmer would send retain and release messages to objects in order to mark objects for deallocation or to prevent deallocation. Under ARC, the compiler does this automatically by examining the source code and then adding the retain and release messages in the compiled code.
ARC differs from Cocoa's garbage collection in that there is no background process doing the deallocation of objects. Unlike garbage collection, ARC does not handle reference cycles automatically; it is up to the programmer to break cycles using weak references.
Apple Inc. delivered a fully featured version of ARC in 2011 for application development on its Mac OS X Lion and iOS 5 operating systems. Before that, a limited version of ARC (ARCLite〔(【引用サイトリンク】url=https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ObjCAvailabilityIndex/ )〕) was supported in Xcode 4.2 or later, Mac OS X 10.6 "Snow Leopard" or later, and iOS 4.0 or later. Mac OS X 10.7 "Lion" or iOS 5 is recommended to use all the features, including weak reference support. Apple's Swift language, introduced in 2014, uses ARC for memory management.
==Rules when using ARC in Objective C==

The following rules are enforced by the compiler when ARC is turned on:
* You cannot call retain, release, retainCount, autorelease, or dealloc.〔(【引用サイトリンク】url=https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html )
:The compiler automatically inserts the correct calls at compile time, including messaging (dealloc ) in an override of dealloc.
:Code example without ARC:

- (void)dealloc

:Code example with ARC:

- (void)dealloc

* You cannot cast directly between id and void
*
.〔 This includes casting between Foundation objects and Core Foundation objects.
:You must use special casts, or calls to special functions, to tell the compiler more information about the object's lifetime.
:Code example without ARC:

- (NSString
*)giveMeAString

:Code example with ARC and a cast:

- (NSString
*)giveMeAString

:Code example with ARC and a function call:

- (NSString
*)giveMeAString

* You cannot use NSAutoreleasePool objects.〔
:You must use the @autoreleasepool syntax. This syntax is now available for all Objective-C modes.
:Code example without ARC:

- (void)loopThroughArray:(NSArray
*)array

:Code example with ARC:

- (void)loopThroughArray:(NSArray
*)array
}

* You cannot call the functions NSAllocateObject and NSDeallocateObject
* You cannot use object pointers in C structures (structs)〔
* You cannot use memory zones (NSZone)〔
* To properly cooperate with non-ARC code, you also cannot create a method or a declared property (unless you explicitly choose a different getter) that begins with "copy".〔

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Automatic Reference Counting」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.